package org.itboys.core.controller.front.tray;

import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiParam;
import org.itboys.core.common.SundayCommonConstants;
import org.itboys.core.dto.order.SundayRecycleOrderDto;
import org.itboys.core.dto.tray.SundayTrayModelDto;
import org.itboys.core.entity.mongo.SundayTrayApply;
import org.itboys.core.service.mongo.front.SundayFrontTrayApplyService;
import org.itboys.core.service.mysql.front.SundayFrontTrayModelService;
import org.itboys.core.service.mysql.front.SundayFrontTrayService;
import org.itboys.core.util.AccountIdHoldUtils;
import org.itboys.core.util.ResponseMessage;
import org.itboys.framework.spring.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

/**
 * 作者：zzq
 * 时间：2018/12/5
 * 描述：托盘模板
 */
@Controller
@RequestMapping("/sunday/mobile/tray")
@Api(value = "tray", description = "托盘")
public class SundayMobileTrayController extends BaseController {
    @Autowired
    private SundayFrontTrayService trayService;
    @Autowired
    private SundayFrontTrayModelService modelService;
    @Autowired
    private SundayFrontTrayApplyService applyService;


    @RequestMapping(value = "/select", method = {RequestMethod.POST})
    @ApiOperation(value = "【供应商端】托盘列表", notes = "托盘列表的接口")
    public void selectByModel(
            HttpServletRequest request,
            HttpServletResponse response
    ){
        Long memberId = AccountIdHoldUtils.getMemberId();
        Map<String, Object> result = trayService.selectByModel(memberId);
        ResponseMessage.success(result);
    }

    @RequestMapping(value = "/countTime", method = {RequestMethod.POST})
    @ApiOperation(value = "【供应商端】托盘跟踪", notes = "托盘跟踪的接口")
    public void count(
            HttpServletRequest request,
            HttpServletResponse response
    ){
        Long memberId = AccountIdHoldUtils.getMemberId();
        Map<String, Object> result = trayService.countTime(memberId);
        ResponseMessage.success(result);
    }



    @RequestMapping(value = "/model/select", method = RequestMethod.POST)
    @ApiOperation(value = "托盘模板列表")
    public void model_select(
            HttpServletRequest request,
            HttpServletResponse response
    ) {
        List<SundayTrayModelDto> result = modelService.select(request);
        ResponseMessage.success(result);
    }






}
